<template>
  <div>
    <TopWrap></TopWrap>
    <div class="upload_box clearfix">
      <div class="upload_header">
        <h1>我的发布</h1>
        <button class="button" @click="openUpload">发布</button>
      </div>
      <div class="upload_body">
        <UploadAndAlterVue
          v-model="uploadFlag"
          v-show="uploadFlag"
        ></UploadAndAlterVue>
        <div class="book_list" v-for="item in uploadGoods" :key="item.id">
          <div class="book_list_top">
            <a href="book_detail.html" target="_blank"
              ><span
                ><img
                  :src="item.img"
                  alt="图片加载失败"
                  :title="item.title"
                  class="goods"
              /></span>
              <h4>
                {{item.title}}
              </h4></a
            >
          </div>
          <div class="book_list_bottom">
            <div class="price">
              <div class="price_unit">¥</div>
              <div class="price_value">{{item.price}}</div>
              <div class="business">出自于{{item.author}}</div>
              <div class="operator">
                <button class="alter">修改</button>
                <button class="disappear">下架</button>
              </div>
            </div>
          </div>
        </div>

        <div class="myupload-page">
          <button class="myupload-page-pre">&lt;</button>
          <span class="myupload-page-pagelist">1</span>
          <button class="myupload-page-next">&gt;</button>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import UploadAndAlterVue from '@/components/UploadAndAlter'
import { mapState } from 'vuex'
export default {
  name: 'UploadGoods',
  data () {
    return {
      uploadFlag: false
    }
  },
  computed: {
    ...mapState(['uploadGoods'])
  },
  components: {
    UploadAndAlterVue
  },
  methods: {
    openUpload () {
      this.uploadFlag = true
    }
  }
}
</script>

<style>
.clearfix:after {
  content: "";
  display: block;
  height: 0;
  clear: both;
  visibility: hidden;
  /* box-sizing: border-box;IE盒模型 */
  /* box-sizing: content-box; */
}
.clearfix {
  /*IE6、7 专有 */
  *zoom: 1;
}
.upload_box {
  position: relative;
  width: 1100px;
  height: 580px;
  margin: 45px auto;
  background-color: white;
  border-radius: 20px;
}
.upload_header {
  position: relative;
  border-bottom: 1px solid #dcdcdc;
  width: 1100px;
  height: 60px;
  line-height: 60px;
  /* background-color: pink; */
}
.upload_header h1 {
  position: absolute;
  top: 0;
  left: 0;
  height: 60px;
  line-height: 60px;
  font-size: 18px;
  font-weight: 400;
  padding-left: 45px;
  /* background-color: antiquewhite; */
}
.upload_header .button {
  position: absolute;
  top: 8px;
  right: 72px;
  width: 90px;
  height: 45px;
  line-height: 45px;
  color: white;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  background-color: #80bcdd;
  transition: 0.3s;
}
.upload_header .button:hover {
  background-color: #118adb;
}
.upload_body {
  position: relative;
  height: 520px;
  /* background-color: pink; */
}

.book_list {
  position: relative;
  width: 152px;
  height: 200px;
  /* width: 265px;
     height: 350px; */
  background: #fff;
  margin: 15px;
  text-align: center;
  float: left;
  border-radius: 10px;
  box-shadow: 2px 4px 5px rgb(0 0 0 / 10%);
  cursor: pointer;
  /* overflow: hidden; */
}

.book_list_top {
  width: 152px;
  overflow: hidden;
  height: 168px;
  /* background-color: pink; */
}

.book_list:hover {
  /* box-shadow: 2px 4px 8px rgb(0 0 0 / 10%); */
  box-shadow: 5px 8px 8px rgb(0 0 0 / 10%);
}

.book_list img {
  width: 100%;
  height: 136px;
  transition: all 0.2s;
}

/* .book_list:hover .goods{
    transform: translateY(-3px);
} */

.book_list h4 {
  height: 24px;
  width: 138px;
  color: #222;
  font: 12px/1 Microsoft Yahei, Hiragino Sans GB, Heiti SC, WenQuanYi Micro Hei,
    sans-serif !important;
  font-weight: 400;
  /* line-height: 20px; */
  margin: 0 auto;
  text-align: left;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.book_list_bottom {
  width: 152px;
  height: 28px;
  margin-top: 4px;
  /* background-color: #118adb; */
}

.book-main-body .price {
  height: 32px;
  padding-left: 8px;
  font-weight: 400;
  text-align: center;
  line-height: 32px;
  vertical-align: middle;
}

.price .price_unit {
  font-size: 8px;
  color: #fd3f31;
  float: left;
  padding-top: 1px;
  margin: 0 2px 0 10px;
  line-height: 22px;
}

.price .price_value {
  font-size: 18px;
  line-height: 12px;
  color: #fd3f31;
  padding-top: 5px;
  float: left;
}

.price .business {
  font-size: 12px;
  color: rgb(153, 153, 153);
  float: left;
  width: 75px;
  height: 24px;
  margin-left: 20px;
  line-height: 24px;
  /* background-color: pink; */
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.book_list .operator {
  display: none;
  position: absolute;
  width: 136px;
  height: 28px;
  bottom: 1px;
  left: 50%;
  color: black;
  font-size: 16px;
  text-align: center;
  line-height: 28px;
  background-image: linear-gradient(
    to right,
    #eb3941,
    #f15e64,
    #e14e53,
    #e2373f
  );
  box-shadow: 0 5px 15px rgba(242, 97, 103, 0.4);
  border-radius: 10px;
  transform: translateX(-50%);
  /* cursor: pointer; */
}

.book_list:hover .operator {
  display: block;
}

.operator .alter,
.operator .disappear {
  width: 40px;
  height: 25px;
  cursor: pointer;
}

.myupload-page {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  width: 880px;
  height: 20px;
  margin: 0 auto;
  text-align: center;
}

.myupload-page .myupload-page-pagelist {
  width: 20px;
  height: 20px;
  text-align: center;
  font-size: 18px;
  line-height: 20px;
  border-bottom: 1px solid #008c8c;
}

.myupload-page .myupload-page-pre,
.myupload-page .myupload-page-next {
  width: 20px;
  height: 20px;
  text-align: center;
  font-size: 18px;
  line-height: 20px;
  margin: 0 12px;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  background-color: #eee;
}
.myupload-page .myupload-page-pre:hover,
.myupload-page .myupload-page-next:hover {
  background-color: #ff7f00;
}
</style>
